package com.bhs.sansonglogistics.utils;

import android.graphics.Color;
import android.os.CountDownTimer;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;

import com.bhs.sansonglogistics.R;

/**
 * @data on 2020/10/16 6:26 PM
 * @auther armstrong
 * @describe 倒计时工具类
 */
public class CountDownTimerUtils2 extends CountDownTimer {
    private TextView mTextView;

    public CountDownTimerUtils2(TextView textView, long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.mTextView = textView;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        mTextView.setClickable(false); //设置不可点击
        mTextView.setText(millisUntilFinished / 1000 + "s后重发");  //设置倒计时时间
    }

    @Override
    public void onFinish() {
        mTextView.setText("重新获取验证码");
        mTextView.setClickable(true);//重新获得点击
    }
}